/*********************************************************
          File Name:bound.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sun 20 Sep 2015 10:01:17 PM CST
**********************************************************/

#include <iostream>
#include <string>
#include <map>
#include <utility>

using std::string;

int main()
{
        std::multimap<string, int> m{{"this", 1}, {"this", 2}};

        m.insert({"this", 3});
        m.insert({"this", 4});
        m.insert({"this", 5});

        auto l = m.lower_bound("this");
        auto u = m.upper_bound("this");

        for(; l != u; ++l)
                std::cout << l->second << " ";
        std::cout << std::endl;

        using Type = std::pair<std::multimap<string, int>::iterator, std::multimap<string, int>::iterator>;

        for(Type pos = m.equal_range("this"); pos.first != pos.second; ++pos.first)
                std::cout << pos.first->second << " ";
        std::cout << std::endl;

        return 0;
}
